class Solution {
public:
    int findNumberOfLIS(vector<int>& nums)
    {
        int n = nums.size();
        vector<int> len(n, 1), count(n, 1);
        int ret = 1, maxC = 1;
        for (int i = 1; i < n; i++)
        {
            for (int j = i - 1; j >= 0; j--)
            {
                if (nums[j] < nums[i])
                {
                    if (len[i] == len[j] + 1)count[i] += count[j];
                    else if (len[i] < len[j] + 1)len[i] = len[j] + 1, count[i] = count[j];
                }

            }
            if (len[i] == maxC)ret += count[i];
            else if (len[i] > maxC)ret = count[i], maxC = len[i];
            //cout<<len[i]<<" "<<count[i]<<endl;


        }



        return ret;

        return ret;

    }
};